<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>营养预警中心 - 智能营养管理系统</title>
    <style>
        /* 基本样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: #333;
            background-color: #f8f9fa;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 15px;
        }
        
        .navbar {
            background-color: #007bff;
            color: white;
            padding: 1rem 0;
            margin-bottom: 2rem;
        }
        
        .navbar-brand {
            font-size: 1.5rem;
            font-weight: bold;
            color: white;
            text-decoration: none;
        }
        
        .page-header {
            background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
            color: white;
            padding: 2rem 0;
            border-radius: 10px;
            margin-bottom: 2rem;
            text-align: center;
        }
        
        .row {
            display: flex;
            flex-wrap: wrap;
            margin: -15px;
        }
        
        .col-md-4 {
            flex: 0 0 33.333333%;
            max-width: 33.333333%;
            padding: 15px;
        }
        
        .col-md-12 {
            flex: 0 0 100%;
            max-width: 100%;
            padding: 15px;
        }
        
        .card {
            background: white;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            padding: 1.5rem;
            margin-bottom: 1rem;
            height: 100%;
        }
        
        .card-header {
            border-bottom: 1px solid #dee2e6;
            padding-bottom: 1rem;
            margin-bottom: 1rem;
        }
        
        .card-title {
            font-size: 1.25rem;
            font-weight: bold;
            margin-bottom: 0.5rem;
        }
        
        .alert-card {
            border-left: 4px solid #dc3545;
        }
        
        .alert-card.high-priority {
            border-left-color: #dc3545;
            background-color: #fff5f5;
        }
        
        .alert-card.medium-priority {
            border-left-color: #ffc107;
            background-color: #fffbf0;
        }
        
        .alert-card.low-priority {
            border-left-color: #17a2b8;
            background-color: #f0f9ff;
        }
        
        .alert-count {
            font-size: 2rem;
            font-weight: bold;
            text-align: center;
            margin-bottom: 0.5rem;
        }
        
        .alert-count.high {
            color: #dc3545;
        }
        
        .alert-count.medium {
            color: #ffc107;
        }
        
        .alert-count.low {
            color: #17a2b8;
        }
        
        .alert-item {
            padding: 1rem;
            margin-bottom: 1rem;
            border-radius: 5px;
            border-left: 4px solid;
        }
        
        .alert-item.high {
            border-left-color: #dc3545;
            background-color: #f8d7da;
            color: #721c24;
        }
        
        .alert-item.medium {
            border-left-color: #ffc107;
            background-color: #fff3cd;
            color: #856404;
        }
        
        .alert-item.low {
            border-left-color: #17a2b8;
            background-color: #d1ecf1;
            color: #0c5460;
        }
        
        .alert-time {
            font-size: 0.9rem;
            color: #6c757d;
            margin-top: 0.5rem;
        }
        
        .btn {
            display: inline-block;
            padding: 0.5rem 1rem;
            border: none;
            border-radius: 5px;
            text-decoration: none;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: center;
        }
        
        .btn-primary {
            background-color: #007bff;
            color: white;
        }
        
        .btn-primary:hover {
            background-color: #0056b3;
        }
        
        .btn-outline-primary {
            background-color: transparent;
            color: #007bff;
            border: 1px solid #007bff;
        }
        
        .btn-outline-primary:hover {
            background-color: #007bff;
            color: white;
        }
        
        .text-center {
            text-align: center;
        }
        
        .text-muted {
            color: #6c757d;
        }
        
        .mb-3 {
            margin-bottom: 1rem;
        }
        
        .nav-tabs {
            display: flex;
            border-bottom: 1px solid #dee2e6;
            margin-bottom: 1rem;
        }
        
        .nav-tab {
            padding: 0.5rem 1rem;
            background-color: transparent;
            border: none;
            border-bottom: 2px solid transparent;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .nav-tab.active {
            border-bottom-color: #007bff;
            color: #007bff;
            font-weight: bold;
        }
        
        .nav-tab:hover {
            background-color: #f8f9fa;
        }
        
        @media (max-width: 768px) {
            .col-md-4, .col-md-12 {
                flex: 0 0 100%;
                max-width: 100%;
            }
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar">
        <div class="container">
            <a class="navbar-brand" href="/">🍃 智能营养管理系统</a>
        </div>
    </nav>
    
    <div class="container">
        <!-- 页面标题 -->
        <div class="page-header">
            <h1>⚠️ 营养预警中心</h1>
            <p>实时监控您的营养状况，及时发现健康风险</p>
        </div>
        
        <!-- 预警统计 -->
        <div class="row">
            <div class="col-md-4">
                <div class="card alert-card high-priority">
                    <div class="card-header">
                        <h5 class="card-title text-center">🚨 高优先级</h5>
                    </div>
                    <div class="alert-count high">2</div>
                    <div class="text-center text-muted">需要立即关注</div>
                </div>
            </div>
            
            <div class="col-md-4">
                <div class="card alert-card medium-priority">
                    <div class="card-header">
                        <h5 class="card-title text-center">⚡ 中优先级</h5>
                    </div>
                    <div class="alert-count medium">2</div>
                    <div class="text-center text-muted">建议调整</div>
                </div>
            </div>
            
            <div class="col-md-4">
                <div class="card alert-card low-priority">
                    <div class="card-header">
                        <h5 class="card-title text-center">💡 低优先级</h5>
                    </div>
                    <div class="alert-count low">1</div>
                    <div class="text-center text-muted">参考建议</div>
                </div>
            </div>
        </div>
        
        <!-- 预警详情 -->
        <div class="row">
            <div class="col-md-12">
                <div class="card">
                    <div class="card-header">
                        <h5 class="card-title">📋 今日预警详情</h5>
                        <div class="text-muted">2025-08-18</div>
                    </div>
                    
                    <!-- 导航标签 -->
                    <div class="nav-tabs">
                        <button class="nav-tab active" onclick="showTab('all')">全部</button>
                        <button class="nav-tab" onclick="showTab('high')">高优先级</button>
                        <button class="nav-tab" onclick="showTab('medium')">中优先级</button>
                        <button class="nav-tab" onclick="showTab('low')">低优先级</button>
                    </div>
                    
                    <!-- 高优先级预警 -->
                    <div id="high-alerts">
                        <h6>🚨 高优先级预警</h6>
                        <div class="alert-item high">
                            <strong>卡路里 严重不足</strong>
                            <div class="alert-time">今日 严重不足，仅达到目标的0.0%，请及时补充营养。</div>
                        </div>
                        <div class="alert-item high">
                            <strong>蛋白质 严重不足</strong>
                            <div class="alert-time">今日蛋白质摄入严重不足，请及时补充。</div>
                        </div>
                    </div>

                    <!-- 中优先级预警 -->
                    <div id="medium-alerts">
                        <h6>⚡ 中优先级预警</h6>
                        <div class="alert-item medium">
                            <strong>碳水化合物 不足</strong>
                            <div class="alert-time">今日碳水化合物摄入不足，仅达到目标的0.0%，建议增加主食摄入。</div>
                        </div>
                        <div class="alert-item medium">
                            <strong>脂肪 不足</strong>
                            <div class="alert-time">今日脂肪摄入不足，建议适量增加健康脂肪。</div>
                        </div>
                    </div>

                    <!-- 低优先级预警 -->
                    <div id="low-alerts">
                        <h6>💡 低优先级预警</h6>
                        <div class="alert-item low">
                            <strong>维生素摄入建议</strong>
                            <div class="alert-time">建议增加蔬菜水果摄入，补充维生素和矿物质。</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 操作按钮 -->
        <div class="row">
            <div class="col-md-12 text-center">
                <a href="/nutrition/dashboard" class="btn btn-primary">营养仪表盘</a>
                <a href="/meals" class="btn btn-outline-primary">去点餐</a>
                <button class="btn btn-outline-primary" onclick="window.location.reload()">刷新</button>
            </div>
        </div>
    </div>
    
    <script>
        function showTab(type) {
            // 移除所有活动状态
            document.querySelectorAll('.nav-tab').forEach(tab => {
                tab.classList.remove('active');
            });
            
            // 添加当前标签的活动状态
            event.target.classList.add('active');
            
            // 显示/隐藏对应的预警内容
            const allAlerts = document.querySelectorAll('#high-alerts, #medium-alerts, #low-alerts');
            
            if (type === 'all') {
                allAlerts.forEach(alert => alert.style.display = 'block');
            } else {
                allAlerts.forEach(alert => alert.style.display = 'none');
                const targetAlert = document.getElementById(type + '-alerts');
                if (targetAlert) {
                    targetAlert.style.display = 'block';
                }
            }
        }
    </script>
</body>
</html>
